. "$builders_dir_root/libepoxy/tmp.kludge0.sh"


pkg_name=libepoxy
git_commit=20062c25e7612cab023cdef44d3277ba1bd0b2de
build_dir=$builds_dir_root/$pkg_name
pkg_dir=$pkgs_dir_root/$pkg_name
src_dir=$src_dir_root/$pkg_name
url=https://github.com/anholt/$pkg_name.git

rm -Rf "$pkg_dir"
cp -r "$src_dir" "$pkg_dir"

cd "$pkg_dir"

git checkout --force $git_commit
git reset --hard

cp -f "$builders_dir_root/$pkg_name/configure.ac.patch" ./
patch -Ni ./configure.ac.patch

cd ./src
cp -f "$builders_dir_root/$pkg_name/src-dispatch_common.h.patch" ./dispatch_common.h.patch
patch -Ni ./dispatch_common.h.patch

cd "$pkg_dir"
export NOCONFIGURE=1
./autogen.sh
unset NOCONFIGURE

rm -Rf "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir"

export CFLAGS=-O0
export PYTHON=/libexec/libepoxy-python/bin/python3
OLD_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/libexec/libepoxy-python/lib/pkgconfig:$PKG_CONFIG_PATH
"$pkg_dir/configure"			\
	--prefix=/			\
	--with-gnu-ld
if test -z "$OLD_PKG_CONFIG_PATH"; then
    unset PKG_CONFIG_PATH
else
    export PKG_CONFIG_PATH=$OLD_PKG_CONFIG_PATH
fi
unset PYTHON
unset CFLAGS

make

install_tmp_dir=/tmp/$pkg_name
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"

install_dirs "$builders_dir_root/$pkg_name/runtime.dirs"
install_files "$builders_dir_root/$pkg_name/runtime.files" "$install_tmp_dir"
install_links "$builders_dir_root/$pkg_name/runtime.links"
install_dirs "$builders_dir_root/$pkg_name/devel.dirs"
install_files "$builders_dir_root/$pkg_name/devel.files" "$install_tmp_dir"
install_links "$builders_dir_root/$pkg_name/devel.links"
elf_strip "$builders_dir_root/$pkg_name/elf-strip"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$pkg_dir"

remove_files "$builders_dir_root/libepoxy/tmp.kludge0.files"
remove_files "$builders_dir_root/libepoxy/tmp.kludge0.links"
remove_dirs "$builders_dir_root/libepoxy/tmp.kludge0.dirs"
